package com.itlong.cloud.user.sdk;

import com.itlong.cloud.POJO.DTO.sdk.CloudDeviceSDKDTO;
import com.itlong.cloud.POJO.DTO.sdk.CloudTalkSDKServerVisitorPwdDTO;
import com.itlong.cloud.POJO.PO.*;
import com.itlong.cloud.POJO.PO.PropertyUserInfoPO;
import com.itlong.cloud.POJO.VO.sdk.CloudTalkSDKServerUserCacheVO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * <desc>
 *      云对讲SDK用户服务暴露层接口
 * </desc>
 *
 * @createDate 2018/05/11
 */
@FeignClient(name = "user-service")
public interface ICloudTalkSDKServerUserServiceClient {

    /**
     * <desc>
     *      申请开发者账号
     * <desc/>
     * @param   userName   开发者账号名称
     * @param  desProjectId      项目编号
     *@return
     * @author JuGuang.S
     * @createDate 2018/05/11
     */
    @PostMapping(path = "/cloudTalkSdk/server/applicationAccount")
    PropertyUserInfoPO applicationAccount(@RequestParam("userName") String userName, @RequestParam("desProjectId") String desProjectId) throws Exception;

    /**
     * <desc>
     *      根据Appsecret查找物业账号用户
     * <desc/>
     * @param   appsecret   密钥
     * @param   desProjectId   项目编号
     *@return
     * @author JuGuang.S
     * @createDate 2018/05/11
     */
    @PostMapping(path = "/cloudTalkSdk/server/getPropertyUserByAppsecret")
    PropertyUserInfoPO getPropertyUserByAppsecret(@RequestParam("appsecret") String appsecret,@RequestParam("desProjectId") String desProjectId) throws Exception;

    /**
     * <desc>
     *      云对讲SDK服务端认证登录
     * <desc/>
     * @param appId     应用接入凭证
     * @param appsecret 应用接入密钥
     * @return  缓存对象
     * @author JuGuang.S
     * @createDate 2018/05/15
     */
    @PostMapping(path = "/cloudTalkSdk/server/sdkServerLogin")
    Integer sdkServerLogin(@RequestParam("appId") String appId, @RequestParam("appsecret") String appsecret);

    /**
     * <desc>
     *      云电梯SDK判断机器人是否有权限
     * <desc/>
     * @param appId     应用接入凭证
     * @param appsecret 应用接入密钥
     * @param robotId 机器人编号
     * @return
     * @author Qiang.S
     * @createDate 2019/01/03
     */
    @PostMapping(path = "/cloudTalkSdk/server/checkRobot")
    Integer checkRobot(@RequestParam("appId") String appId, @RequestParam("appsecret") String appsecret, @RequestParam("robotId") String robotId);

    /**
     * <desc>
     *      云电梯SDK判断机器人是否有权限
     * <desc/>
     * @param dto
     * @return
     * @author Qiang.S
     * @createDate 2020/03/23
     */
    @PostMapping(path = "/cloudTalkSdk/server/checkRobotNew")
    Integer checkRobotNew(@RequestBody CloudDeviceSDKDTO dto);

    /**
     * <desc>
     *      从缓存中获取appid
     * </desc>
     *
     * @param token 用户token
     * @param tokenType 1代表APP开门音视频切换的token 2代表除此之外的token
     * @return
     * @author Jiaqi.X
     * @createDate 2018/05/17
     */
    @PostMapping(path = "/cloudTalkSdk/server/retrieve")
    CloudTalkSDKServerUserCacheVO retrieve(@RequestParam("token") String token,@RequestParam("tokenType") String tokenType);

    /**
     * <desc>
     *      根据appId获取该应用下所关联的项目信息
     * </desc>
     *
     * @param appId 应用Id
     * @return
     * @author Juguang.S
     * @createDate 2018/12/21
     */
    @PostMapping(path = "/cloudTalkSdk/server/getProjectIdByParams")
    List<String> getProjectIdByParams(@RequestParam("appId") String appId);

    /**
     * <desc>
     *      云对讲SDK APP端认证登录
     * <desc/>
     * @param appId     应用接入凭证
     * @param appsecret 应用接入密钥
     * @return  缓存对象
     * @author JuGuang.S
     * @createDate 2018/11/21
     */
    @PostMapping(path = "/cloudTalkSdk/server/sdkAppLogin")
    CloudTalkSDKServerUserCacheVO sdkAppLogin(@RequestParam("appId") String appId, @RequestParam("appsecret") String appsecret);

    /**
     * <desc>
     *      云对讲SDK 生成访客动态密码
     * <desc/>
     * @param visitorPwdDTO     生成访客动态密码的信息
     * @return
     * @author JuGuang.S
     * @createDate 2018/11/24
     */
    @PostMapping(path = "/cloudTalkSdk/server/getVisitorQrCode")
    AppVisitorPassCodeRecordPO getVisitorPwdAndQrCode(@RequestBody CloudTalkSDKServerVisitorPwdDTO visitorPwdDTO) throws Exception;

    /**
     * <desc>
     *      校验buildNum unitNum 该项目下是否有该单元信息
     * <desc/>
     * @param visitorPwdDTO     生成访客动态密码的信息
     * @return
     * @author JuGuang.S
     * @createDate 2018/11/24
     */
    @PostMapping(path = "/cloudTalkSdk/server/getExistBuildInfo")
    Map<String,String> getExistBuildInfo(@RequestBody CloudTalkSDKServerVisitorPwdDTO visitorPwdDTO);

    /**
     * <desc>
     *      根据ProjectId,buildNum查询出该楼栋的最高楼层
     * <desc/>
     * @param
     * @return
     * @author JuGuang.S
     * @createDate 2018/12/14
     */
    @PostMapping(path = "/cloudTalkSdk/server/getBuildFloorNum")
    Integer getBuildFloorNum(@RequestParam("projectId") String projectId,@RequestParam("buildNum") String buildNum);
}
